package com.example.web ;

import com.example.service.CategoryService;
import com.example.model.Category;
import com.example.model.query.CategoryExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created on 2017/12/26 18:50
 */
@RestController
@RequestMapping(value = "/category")
public class CategoryController {

	@Autowired
	private CategoryService categoryService;


	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public Category selectByPrimaryKey(@PathVariable("id") Byte id) {
		return categoryService.selectByPrimaryKey(id);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
	public void deleteByPrimaryKey(@PathVariable("id") Byte id) {
        categoryService.deleteByPrimaryKey(id);
	}

    @RequestMapping(value = "/", method = RequestMethod.POST)
    public void insertSelective(@RequestBody Category category) {
        categoryService.insertSelective(category);
    }

	@RequestMapping(value = "/", method = RequestMethod.PUT)
	public void updateByPrimaryKeySelective(@RequestBody Category category) {
        categoryService.updateByPrimaryKeySelective(category);
	}

}